home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3023 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: GCC and Default Constructors
  5. Date: 21 Jan 1996 18:04:17 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4dtv71$1eh@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe11.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Jan 20, 1996 17:29:29 in article <GCC and Default Constructors>, 'Eric
  15. Richard <erichard@netgen.com>' wrote: 
  16.  
  17.  
  18. >I just spent about 3 days intermittently trying to solve a problem that 
  19. >I finally figured out and I was trying to see if there is something  
  20. >I can do to avoid a similar situation. 
  21. >Basically my problem stemmed from a typo on my part and the fact 
  22. >that C++ will automatically provide a default constructor for you if 
  23. >you don't provide one.  To make a long story short, I had a class 
  24. >named 'QueryTable' and had defined a constructor 'queryTable::QueryTable'.
  25.  
  26. >Now obviously this is wrong, but what was screwing me up was that no 
  27. >error was being generated because G++ was happily providing me with 
  28. >a default constructor for my class. 
  29. Are you saying that the compiler accepted a function definition 
  30. for an undeclared class???  Any decent compiler -- and gcc/g++  
  31. certainly is decent -- should not only warn you, but refuse to compile 
  32. the file.  Maybe you've left out something relevant.  Or maybe you 
  33. have another typo. 
  34.  
  35. >So, my question is this:  Does anybody know if there is some way 
  36. >of at least getting G++ to warn you if it is using a default constructor? 
  37. >If I had that, I would've been able to figure this out much more quickly. 
  38. No, there isn't, and I'm not convinced that there ought to be one. 
  39. Like the old saw:  Too many warnings spoil the stew -- or maybe I 
  40. now have a typo :-).   
  41.  
  42. Excessive warnings defeat their purpose.  IMHO, warnings about 
  43. default constructors borderlines on the excessive. 
  44.   
  45. -- 
  46. Pete Grant 
  47. Kalevi, Inc. 
  48. Object Oriented Software Development
  49.